package exam.xiecheng.autumn.S2;

import java.util.*;

public class Main {

    public static int n;
    public static int a;
    public static int b;
    public static int c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            a = sc.nextInt();
            b = sc.nextInt();
            c = sc.nextInt();
            System.out.println(solution());
        }
    }

    private static int solution() {
        int x = Math.min(a, Math.min(b, c));
        if (b == x)
            return x * 2;
        return b - x - 1 + x * 2;
    }
}